<template>
  <Modal v-model="showModal" width="360" :closable="false" :mask-closable="false">
    <p slot="header" style="color: #f60; text-align: left;">
      <Icon type="ios-information-circle"></Icon>
      <span>系统信息</span>
    </p>
    <div style="text-align:center">
      <p style="text-align:center; font-size: 16px;">检测到token已失效，需重新登录！</p>
    </div>
    <div slot="footer">
      <Button type="error" size="large" long @click="turnTo">重新登录</Button>
    </div>
  </Modal>
</template>

<script>
export default {
  name: 'TokenModal',
  props: {
    toggle: {
      type: Boolean
    }
  },
  data () {
    return {
      showModal: false
    }
  },
  watch: {
    toggle (newVal) {
      this.showModal = newVal
    }
  },
  methods: {
    // 重新登录
    turnTo () {
      this.$router.push({
        path: '/login'
      })
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '~@/style/main-panel.styl'
</style>
